<template>
	<wt-select
		:options="field.options"
		v-if="form.type == '1'"
		v-model="form[field.tableName]" >
	</wt-select>
	<el-input v-else-if="form.type == '2'" v-model="form[field.taleName]"></el-input>
</template>
<script>
	import Select from 'winged/components/wt-select';
	export default {
		name:"wt-article-template",
		props:{
			field: {
				type: Object,
				required: true,
			},
			form:{
				type:Object,
				default:{}
			},
			value:{
				type:[Object,String],
				default:function(){
					return {}
				}
				},
			paramsData: {
				type: Object,
				default:function(){
					return {}
				}
			},
		},
		watch:{
			'form.type':{				
				immediate:true,
				handler:function(val){
				if(val == 1){
					this.field.label = '文章模板'
					this.field.tableName = 'template'
					this.field.rules[0].required = true
					this.field.rules[0].message = '请选择文章模板'
					this.field.rules[0].trigger = 'blur'
				}else if(val == 2){
					this.field.label = '文章链接'
					this.field.tableName = 'url'
					this.field.name = 'url'
					this.field.rules[0].required = true
					this.field.rules[0].message = '请输入文章链接'
					this.field.rules[0].trigger = 'blur'
				}
			}
			}
		},
		components:{
			[[Select.name]]:Select,
		}
	}
</script>